home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / ncurses-5.3 / ncurses / tinfo / MKcaptab.awk < prev    next >
Encoding:
Text File  |  2002-10-27  |  1.3 KB  |  72 lines

  1. #!/bin/sh
  2. # $Id: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $
  3. AWK=${1-awk}
  4. DATA=${2-../include/Caps}
  5.  
  6. cat <<'EOF'
  7. /*
  8.  *    comp_captab.c -- The names of the capabilities indexed via a hash
  9.  *                 table for the compiler.
  10.  *
  11.  */
  12.  
  13. #include <ncurses_cfg.h>
  14. #include <curses.priv.h>
  15. #include <tic.h>
  16. #include <term.h>
  17.  
  18. EOF
  19.  
  20. ./make_hash 1 info <$DATA
  21. ./make_hash 3 cap  <$DATA
  22.  
  23. cat <<'EOF'
  24. const struct alias _nc_capalias_table[] =
  25. {
  26. EOF
  27.  
  28. $AWK <$DATA '
  29. $1 == "capalias"    {
  30.             if ($3 == "IGNORE")
  31.             to = "(char *)NULL";
  32.             else
  33.             to = "\"" $3 "\"";
  34.             printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
  35.                 $2, to, $4, $5
  36.         }
  37. '
  38.  
  39. cat <<'EOF'
  40.     {(char *)NULL, (char *)NULL, (char *)NULL}
  41. };
  42.  
  43. const struct alias _nc_infoalias_table[] =
  44. {
  45. EOF
  46.  
  47. $AWK <$DATA '
  48. $1 == "infoalias"    {
  49.             if ($3 == "IGNORE")
  50.             to = "(char *)NULL";
  51.             else
  52.             to = "\"" $3 "\"";
  53.             printf "\t{\"%s\", %s, \"%s\"},\t /* %s */\n",
  54.                 $2, to, $4, $5
  55.         }
  56. '
  57.  
  58. cat <<'EOF'
  59.     {(char *)NULL, (char *)NULL, (char *)NULL}
  60. };
  61.  
  62. NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap)
  63. {
  64.     return termcap ? _nc_cap_table: _nc_info_table ;
  65. }
  66.  
  67. NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap)
  68. {
  69.     return termcap ? _nc_cap_hash_table: _nc_info_hash_table ;
  70. }
  71. EOF
  72.